<?php
class ActivityConf_getExcelList {
	function getExcelList($game, $activityNameEn = '') {

		$nodeDao = MooDao::get('Node');
		if($activityNameEn) {
			$sql = 'select * from @TABLE where node_game =:game and node_activity_id =:activityNameEn';
			$where = array(
				'game' => $game,
				'activityNameEn' => $activityNameEn,
			);
		} else {
			$sql = 'select * from @TABLE where node_game =:game';
			$where = array(
				'game' => $game,
			);
		}
		
		$excelList = $nodeDao->getAll($sql, $where);
		
		/**
		 * 当前所有文件
		 */
		if($excelList) {
			foreach($excelList as $key => $val) {
				$activityInfo = MooObj::get('ActivityConf')->getActivityInfoByEn($game, $val['node_activity_id']);
				$activityNameZh = $activityInfo['activityNameZh'];
				$activityId 	= $activityInfo['activityId'] ? $activityInfo['activityId'] : 0;
				$excelList[$key]['activityId'] = $activityId;
				$excelList[$key]['node_size'] = sprintf("%.1f", $val['node_size']) . "KB";  
				$excelList[$key]['node_update_time'] = date('Y-m-d H:i:s', $val['node_update_time']);
				$excelList[$key]['node_activity_id'] = $activityNameZh;
				$excelList[$key]['node_create_time'] = date('Y-m-d H:i:s', $val['node_create_time']);
			}
		}
		
		return $excelList;
	}
}